import  requests,json,time
# import base64,rsa
# from Crypto.PublicKey import RSA

# # 获取token
# # 生成秘钥对象
# public = '''-----BEGIN PUBLIC KEY-----
# MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCiwGEjf8tUjh2sr43YncN+yM/s
# 6GeHgNiTxQ7F5IOO4Fv7hwTKpi0oo05mIRTOK4Nk5fYNqv/SZZO6OiH6EpVfb7wK
# U8kVYYJ5JzI/5o3iJnR9ki01i1ztW0Y/oHa46zsU/DQSZ70UWm+Cw3cehhFlFQtG
# roJsskNxU+LY61q3bQIDAQAB
# -----END PUBLIC KEY-----'''
# key = RSA.import_key(public)

# # 加密
# msg = str(int(time.time())).encode()
# password = rsa.encrypt(msg,key)
# # 转换base64
# sign = base64.b64encode(password).decode()

# #构建data
# token_data = {
#   "client_type" : "OPEN_PARTNER",
#   "client_id" : "ikof1600985829ebb44",
#   "request_time" : int(msg.decode()),
#   "options" : {
#     "token_lifetime" : 7200
#   },
#   "sign" : sign
# }

# token_header = {"Content-Type": "application/json; charset=UTF-8", 'Connection': 'close'}

# response = requests.post('https://open.ikuai8.com/api/v3/open/access_token', data=json.dumps(token_data), headers=token_header)
# res = response.json()

# token = res['access_token']

# token = {"Authorization" : "Basic b3BlbmNsaWVudDpvcGVuY2xpZW50"}

# login = requests.post('http://dev.meter-iot.cn/api/auth/oauth/token?grant_type=client_credentials&scope=open', headers=token)
# login_index = login.json()
# login_token = {"Authorization" : "Bearer {}".format(login_index['access_token'])}

# electric = requests.get('http://dev.meter-iot.cn/api/open/openapi/read/info/1/{}'.format(340119017114), headers=login_token)
# electric_index = electric.json()
# electric_extendDict = electric_index['data']['extendDict']
# print(electric_extendDict)

now = int(time.time())
print(now)